package com.oxy.model.dao.util;

import java.util.Map;

public class DaoRegister {
	private Map<String, Object> daoMap = null;
	
	public Map<String, Object> getDaoMap() {
		return daoMap;
	}
	public void setDaoMap(Map<String, Object> daoMap) {
		this.daoMap = daoMap;
	}
	
	@SuppressWarnings("rawtypes")
	public Object getDaoByIfClass(Class interfaceClass) throws DaoNotFoundException {
		Object obj = daoMap.get(interfaceClass.getName());
		if(obj == null)
			throw new DaoNotFoundException("DAO ["+interfaceClass.getName()+"] not found! Please regist it in Spring config first.");

		return obj;
	}
}
